package com.showapi.app

import com.showapi.app.util.ConstantsOfShowapi
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.ApplicationArguments
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.CommandLineRunner
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class Bootstrap implements ApplicationRunner {
    @Autowired
    ApplicationContext ctx

    @Override
    public void run(ApplicationArguments args) throws Exception {
        ConstantsOfShowapi.ctx=ctx        //注入

        ctx.getBean("dynamicService").reloadClass() //初始化时加载
        ctx.getBean("flowService").reloadClass() //初始化时加载


        if(ConstantsOfShowapi.IS_DEV){
            init_dev()
        }else{
            init_prod()
        }



    }

    public void init_dev(){
        println "init_dev"

    }

    public void init_prod(){
        println "init_prod"

    }

}